var https = 'https://qiyun-1256751864.cos-website.ap-guangzhou.myqcloud.com'
var imgurl = '/zhong/'
export default {
  //时间戳转换
  timestampToTime(timestamp) {
    var date = new Date(timestamp * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
    var Y = date.getFullYear() + "-";
    var M =
      (date.getMonth() + 1 < 10 ?
        "0" + (date.getMonth() + 1) :
        date.getMonth() + 1) + "-";
    var D = date.getDate() + " ";
    var h = date.getHours() + ":";
    var m = date.getMinutes() + ":";
    var s = date.getSeconds();
    return Y + M + D + h + m + s;
  },
  getimgurl(url) {
    return https + imgurl + url;
  },
  loadmore(vm, obj, cb, cb1) {
    let that = vm;
    obj.parameter.page++;
    that.axios.post(obj.api, obj.parameter)
      .then(function (res) {
        // console.log(res);
        if (res.data.code === 200) {
          // console.log(200);
          cb && cb(res);//200
          // console.log(res);
          let newArr = [...obj.oldArr, ...res.data.data];
          cb1 && cb1(newArr);
          // console.log(newArr);
        } else {
          console.log('400',res);
          let newData = false;
          cb && cb(newData);//400
        }
       
      })
      .catch(function (error) {
        error = error + "";
        if (error.search("timeout") !== -1) {
          //超时判断
          that.loading_read = true;
        }
      });
  },

}
